#include "../../StickyInput.h"



int main(int argc, char* argv[])
{
    char buff[] = "SDL_VIDEO_CENTERED=center";
    SDL_putenv(buff);
    
    if( SDL_Init(SDL_INIT_VIDEO) < 0 )
    {
        printf("Couldn't initialize SDL: %s\n", SDL_GetError());
        return 0;
    }
    
    int w = 400, h = 400;

    SDL_Surface* screen = SDL_SetVideoMode(w, h, 0, SDL_SWSURFACE);

    if ( screen == NULL ) {
        printf("Couldn't set video mode %dx%d: %s\n", w, h, SDL_GetError());
		return 0;
    }
    printf(" running @ %dx%d %dbpp (done)\n", w, h, screen->format->BitsPerPixel);
    
    
    // Reset joysticks
    SI::Reset();
    
    if(SI::WasInit())
        printf("Ready to go!\n");
    else
    {
        printf("Failed initialization.");
        return 0;
    }
    
    for(int i = 0; i < SI::NumJoysticks(); i++)
    {
        SI::JoystickInfo info(i);
        printf("%s:\n  %d Axes\n  %d Buttons\n  %d Hats\n  %d Balls\n\n", info.name, info.axes, info.buttons, info.hats, info.balls);
    }
    
    printf("Monitoring input.  Press ESCAPE to quit.\n\n");
    SI::MonitorInput(SI::PrintButton, 8000);
    
    SDL_Quit();
    return 0;
}
